package com.info33.platform.common.util;

import org.apache.shiro.crypto.hash.SimpleHash;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

/**
 * @author Administrator
 */
public class PasswordUtil {

    private PasswordUtil() {
    }

    public static Map<String, String> passwordMd5(String password) {
        return confirmPass(password, UUID.randomUUID().toString().replace("-", ""));
    }

    public static Map<String, String> confirmPass(String password, String salt) {
        String repass = new SimpleHash("MD5", password, salt, 2).toString();
        Map<String, String> map = new HashMap<>(8);
        map.put("password", repass);
        map.put("salt", salt);
        return map;
    }
}
